$(function(){
    $('.aside-menu').on('click',function(){
        var h=$(document).height();
        $('.slide-mask').css('height',h).show();
        $('.aside-nav').css('height',h).animate({left:0},300);
        $('.aside-menu b:nth-child(1)').animate({left:'20%',top:'8%',width:0,height:'80%'},300);
        $('.aside-menu b:nth-child(2)').animate({left:'50%',top:'8%',width:0,height:'80%'},300);
        $('.aside-menu b:nth-child(3)').animate({left:'75%',top:'8%',width:0,height:'80%'},300);
    });
    $('.slide-mask').on('click',function(){
        $('.slide-mask').hide();
        $('.aside-nav').animate({left:'-50%'},300);
        $('.aside-menu b:nth-child(1)').animate({left:'8%',top:'20%',width:'80%',height:0},300);
        $('.aside-menu b:nth-child(2)').animate({left:'8%',top:'50%',width:'80%',height:0},300);
        $('.aside-menu b:nth-child(3)').animate({left:'8%',top:'75%',width:'80%',height:0},300);
    });

    $('.mediaMenu').children().each(function(){
        $(this).click(function(){
            var bcolor=$(this).css('borderColor');
            $(this).css('backgroundColor',bcolor);
            var imgSrc=$(this).children(0).attr('src').substring(0,16)+'-.png';
            $(this).children(0).attr('src',imgSrc);
            $(this).siblings().each(function(){
                $(this).css('backgroundColor','#fff');
                var imgSrc=$(this).children(0).attr('src').substring(0,16)+'.png';
                $(this).children(0).attr('src',imgSrc);
            });
            if($(this).index('.mediaMenu li')==0){
                if($(this).hasClass('active')){
                    return;
                }else {
                    $('.about-media-box .active').removeClass('active').animate({left: '-100%'}, 500);
                    $('.about-weixin-box').addClass('active').animate({left: 0}, 500);
                }
            }else if($(this).index('.mediaMenu li')==1){
                    if($(this).hasClass('active')){
                        return;
                    }else{
                        $('.about-media-box .active').removeClass('active').animate({left:'-100%'},500);
                        $('.about-new-box').addClass('active').animate({left:0},500);
                }
            }else if($(this).index('.mediaMenu li')==2){
                    if($(this).hasClass('active')){
                        return;
                    }else{
                        $('.about-media-box .active').removeClass('active').animate({left:'-100%'},500);
                        $('.about-weibo-box').addClass('active').animate({left:0},500);
                    }
            }else if($(this).index('.mediaMenu li')==3){
                        if($(this).hasClass('active')){
                            return;
                        }else{
                            $('.about-media-box .active').removeClass('active').animate({left:'-100%'},500);
                            $('.about-search-box').addClass('active').animate({left:0},500);
            }
                    }
        });
    });
    setInterval(function(){
       $('.about-section3 .p1').animate({height:'180px'},1400).animate({height:'150px'},1400);
        $('.about-section3 .p4').animate({height:'120px'},1400).animate({height:'150px'},1400);
        setInterval(function(){
            $('.about-section3 .p2').animate({height:'180px'},1400).animate({height:'150px'},1400);
            $('.about-section3 .p3').animate({height:'120px'},1400).animate({height:'150px'},1400);
        },3000);
    },6000);
    setInterval(function(){
        $('.about-section7 ul li:even img').animate({top:'-10px'},1000).animate({top:0},1000);
        setInterval(function(){
            $('.about-section7 ul li:odd img').animate({top:'10px'},1000).animate({top:0},1000);
        },6000)
    },6000);

    $('.help-section ul').children().each(function(){
        $(this).click(function(){
            var section=$($(this).children().get(1));
            if(section.css('display')==='block'){
                section.fadeOut(500);
            }else{
                section.fadeIn(1000);
            }
            $(this).siblings().each(function(){
                $($(this).children().get(1)).fadeOut(100);
            });



        });
    });
    var deg=0;
    setInterval(function(){
        var d='rotate('+deg+'deg)';
        $('.promotion-section1-img').css('transform',d);
        deg+=1;
    },100)

});
